#ifndef ROUND_BORDER_H
#define ROUND_BORDER_H

//生成自定义样式按钮
#include <QPushButton>
#include <QPaintEvent>
#include <QPainter>
#include <QMouseEvent>
#include <QColor>
#include <QTime>
class Round_Button :public QPushButton
{
    Q_OBJECT
public:
    Round_Button(QWidget* parent);
    void setPressColor(const QColor color);
    void setColor(const QColor color);
    void setTxet(const QString& text);
    void setTxetFontAndColor(QFont font,QColor color);

signals:
    void  m_clicked();
protected:
    //重写事件
    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent* event) override;
    void mouseReleaseEvent(QMouseEvent *ev) override;
    void enterEvent(QEvent *event)override;
    void leaveEvent(QEvent *event)override;

private:
    bool m_isfirst=true;
    bool m_ishover=false;
    QTime m_time;//暂留用于设置检测是否长按

    int m_x;
    int m_y;
    int m_w;
    int m_h;

     //文本设置
    QFont m_font;
    QString m_text;
    QColor textColor;
    //背景颜色
    QColor m_color;
    QColor m_pressColor;
    QColor m_releaseColor;
};

#endif // ROUND_BORDER_H
